const MongoHeartbeat = require('mongo-heartbeat');
const hb = MongoHeartbeat("localhost:27017:mongodb", {
    interval: 5000, //defaults to 5000 ms,
    timeout: 10000,  //defaults to 10000 ms
    tolerance: 2    //defaults to 1 attempt
});

hb.on('error', function (err) {
    console.error('mongodb didnt respond the heartbeat message');
    process.nextTick(function () {
        process.exit(1);
    });
});
